/**
 * \file log.h
 * \brief Logging functions allow different (integer) logging levels.
 **/

#ifndef R_LOG_H
#define R_LOG_H

/**
 * \brief Logging levels.
 **/
#define R_DETAILED 1  /* Almost every function calls this to say what it
                        * did. */
#define R_DEBUG 2     /* More important operations log what they did here. */
#define R_WARNING 3   /* Uncommon behaviour should be logged here. */

/**
 * \brief Current logging level. Eventually this should be controlled from the
 * scons.
 **/
#define R_LOG_LEVEL R_DETAILED

/**
 * \brief Log a debugging message. This uses a gcc extension (variable length
 * macros).
 **/
#define r_debug(level, fmt,...) r_debug_raw(level, \
                                              (char*) __func__, \
                                              fmt, \
                                              __VA_ARGS__)

void r_debug_raw(int level, char* func, char *fmt, ...);

#endif /* R_LOG_H */
